<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<title> - 藏品</title>
		<meta name="keywords" content="">
		<meta name="description" content="">

		<link rel="shortcut icon" href="__PUBLIC__/admin/favicon.ico">
		<link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
		<link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">

		<link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
		<link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
		<link rel="stylesheet" href="__PUBLIC__/admin/css/viewer.min.css">
        <link href="__PUBLIC__/admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">

	</head>

	<body class="gray-bg">
		<div class="wrapper wrapper-content animated fadeInRight">
			<div class="row">
				<div class="panel panel-default panel-first panel-list">
					<div class="panel-body">
						<div class="ay-header-action-bar" style="padding-left: 0px">
							<div class="pull-left">
								<a href="{:URL('news/newedit')}">
									<i class="fa fa-plus"></i> 藏品
								</a>
								<a href="javascript:;" id="dw">
                            		<i class="fa fa-cloud-download"></i> 导出
                        		</a>
							</div>
							<div class="pull-right">
							</div>
							<div class="clearfix"></div>
						</div>
						<form action="{:url('Collect/collection')}" method="get">
							<br>
							<div class="form-inline">
								<input type="text" name="name" class="ay-search-width100 form-control" value="" placeholder="藏品名称">
								<input type="text" name="num" class="ay-search-width100 form-control" value="" placeholder="合同号">
								<input type="text" name="type" class="ay-search-width100 form-control" placeholder="类别" value="">
								<input type="text" name="material" class="ay-search-width100 form-control" placeholder="材质" value="">
								<input type="text" name="years" class="ay-search-width100 form-control" placeholder="年代" value="">
								<input type="text" name="zman" class="ay-search-width100 form-control" placeholder="征集人" value="">
								<p></p>
								<input type="text" name="author" class="ay-search-width100 form-control" placeholder="作者" value="">
								<input type="text" name="user" class="ay-search-width100 form-control" placeholder="委托单位" value="">
								<input type="text" name="cnum" class="ay-search-width100 form-control" placeholder="库区号" value="">
								<input type="text" name="mount" class="ay-search-width100 form-control" placeholder="装裱形式" value="">
								<select name="state" class="ay-search-width100 form-control">
									<option value="">--状态--</option>
									<option value="0">在库</option>
									<option value="1">出库</option>
									<option value="2">转库</option>
								</select>
							</div>
							<br>
							<div class="form-inline">
								<button type="submit" class="btn btn-primary">搜索</button>
								<a href="{:url('Collect/collection')}" class="btn btn-danger">清空</a>
							</div>
							<br>
						</form>
						<table class="table table-hover table-bordered table-list ay-table">
							<thead>
								<tr>
									<th width="2%">序号</th>
									<th style="text-align: center;width: 4%">
                            <input type="checkbox" class="js-check-all-btn"/>
                        </th>
									<th style="text-align: center;width: 14%">缩略图</th>
									<th style="text-align: center;width: 8%">合同号</th>
									<th style="text-align: center;width: 14%">名称</th>
									<th style="text-align: center;width: 8%">类别</th>
									<th style="text-align: center;width: 18%">特征</th>
									<th style="text-align: center;width: 6%">作者</th>
									<th style="text-align: center;width: 6%">点评</th>
									<th style="text-align: center;width: 12%">状态</th>
									<th style="text-align: center;width: 10%">操作</th>
								</tr>
							</thead>
							<tbody>
								{foreach name="datac" item="v"}
								<tr>
									<td style="vertical-align: middle"class="js-num"></td>
									<td style="text-align: center;width: 4%">
                            <input name="test[]" type="checkbox" id="del_id[]" class="js-check-all" value="{$v.id}"/>
                        </td>
									<td class="ay-center" style="vertical-align: middle;text-align: center;">
										{volist name="v['image2']" id="vo" offset="0" length="1"}
											<img src="__PUBLIC__/uploads/{$vo}" data-original="__PUBLIC__/uploads/{$vo}" data-images="__PUBLIC__/uploads/{$vo}" class="js-viewer-image" style="cursor: zoom-in;height:80px;width:80px;">
									    {/volist}
									</td>
									<td class="ay-center" style="vertical-align: middle">{$v.num}</td>
									<td style="vertical-align: middle">
										<p>{$v.name}</p>
									</td>
									<td class="ay-center" style="vertical-align: middle">{$v.type}</td>
									<td style="vertical-align: middle">
										<span style="font-size: 12px;color: grey;">材质：{$v.material}</span>
										<br>
										<span style="font-size: 12px;color: grey;">委托单位：{$v.user}</span>
										<br>
										<span style="font-size: 12px;color: grey;">首次入库时间：{$v.time|date="Y-m-d H:i:s",###}</span>
										<br>
										<span style="font-size: 12px;color: grey;">库区号：{$v.cnum}</span>
									</td>
									<td class="ay-center" style="vertical-align: middle">
										<p>{$v.author}</p>
									</td>
									<td class="ay-center" style="vertical-align: middle">
										{if condition="($power['power']==1)||($power['power']==2)"}
										<a href="{:URL('collect/comment?id='.$v['id'])}">[添加]</a>
										{/if}
										<a href="{:URL('collect/liulan?id='.$v['id'])}">[浏览]</a>
									</td>
									<td class="ay-center" style="vertical-align: middle">
										{if condition="$v['state']==0 "}<span class="label label-danger">在库</span> {elseif condition="$v['state']==1"}<span class="label label-success">出库</span> {elseif condition="$v['state']==2"}<span class="label label-primary">转库</span> {/if} {if condition="$v['why']==''"}
										<p></p>
										{else}
										<p>【{$v['why']}】</p>
										{/if}
										<!--   <span class="label label-success">出库</span> -->
									</td>
									<td class="ay-center" style="vertical-align: middle">
										{if condition="($power['power']==1)||($power['power']==2)"}
										<a href="{:URL('News/newschange?id='.$v['id'])}">[编辑]</a>
										{/if}
										<a href="{:URL('Collect/showInfo?id='.$v['id'])}" class="showInfo">[浏览]</a>
										{if condition="($power['power']==1)||($power['power']==2)"}
									 	<a class="js-ajax-page-delete" href="{:URL('Collect/delete?id='.$v['id'])}">[删除]</a> 
								<!-- 	<a class="js-ajax-page-delete" href="javascript:del({$v['id']});">[删除]</a> -->
										{/if}
										<!--  <a href="#" class="log">[日志]</a> -->
									</td>
								</tr>
								{/foreach}
							</tbody>
						</table>
						<div style="float:right;">
						{$list}
							</div>
							<script type="text/javascript">
								function nextPage(page) {
									if(true && document.forms[0]) {
										var url = document.forms[0].getAttribute("action");
										if(url.indexOf('?') > -1) {
											url += "&currentPage=";
										} else {
											url += "?currentPage=";
										}
										url = url + page + "&showCount=10";
										document.forms[0].action = url;
										document.forms[0].submit();
									} else {
										var url = document.location + '';
										if(url.indexOf('?') > -1) {
											if(url.indexOf('currentPage') > -1) {
												var reg = /currentPage=\d*/g;
												url = url.replace(reg, 'currentPage=');
											} else {
												url += "&currentPage=";
											}
										} else {
											url += "?currentPage=";
										}
										url = url + page + "&showCount=10";
										document.location = url;
									}
								}

								function changeCount(value) {
									if(true && document.forms[0]) {
										var url = document.forms[0].getAttribute("action");
										if(url.indexOf('?') > -1) {
											url += "&currentPage=";
										} else {
											url += "?currentPage=";
										}
										url = url + "1&showCount=" + value;
										document.forms[0].action = url;
										document.forms[0].submit();
									} else {
										var url = document.location + '';
										if(url.indexOf('?') > -1) {
											if(url.indexOf('currentPage') > -1) {
												var reg = /currentPage=\d*/g;
												url = url.replace(reg, 'currentPage=');
											} else {
												url += "1&currentPage=";
											}
										} else {
											url += "?currentPage=";
										}
										url = url + "&showCount=" + value;
										document.location = url;
									}
								}

								function toTZ() {
									var toPaggeVlue = document.getElementById("toGoPage").value;
									if(toPaggeVlue == '') {
										document.getElementById("toGoPage").value = 1;
										return;
									}
									if(isNaN(Number(toPaggeVlue))) {
										document.getElementById("toGoPage").value = 1;
										return;
									}
									nextPage(toPaggeVlue);
								}
							</script>

							<div class="clearfix"></div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<!-- 全局js -->
		<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
		<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
 		<script src="__PUBLIC__/admin/js/plugins/sweetalert/sweetalert.min.js"></script>

		<!-- 自定义js -->
		<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
		<script src="__PUBLIC__/admin/js/plugins/viewerjs/viewer-jquery.min.js"></script>
		<script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
		<script>
			// 缩略图
		  $(function () {
            var $viewer_images = $('.js-viewer-image');
            $viewer_images.on("click", function () {
                var $this = $(this);
                var artworkName = $this.attr("alt");
                var imagesToShow = [];
                var images = $this.data("images");
                images = images.split(",");

                $.each(images, function (i, image) {
                    if (image) {
                        imagesToShow.push({
                            title: artworkName,
                            url: image
                        });
                    }
                });
                parent.create_viewer(imagesToShow, 'art-artwork-list-viewer', 0, {});
            });
        });
		  $(function(){
		        //$('table tr:not(:first)').remove();
		        var len = $('table tr').length;
		        for(var i = 1;i<len;i++){
		            $('table tr:eq('+i+') td:first').text(i);
		        }
		            
		});
			
			
			//日志
		</script>
	</body>

</html>
<script>
$(function () {
    // 编号自增
    for (var ii = 0; ii < $(".js-num").length; ii++) {
        $('.js-num').eq(ii).text(ii + 1);
    }
    // 全选
    $('.js-check-all-btn').click(function () {
        $('.js-check-all').prop('checked', this.checked);
        // 设置属性和值：
        // $(selector).prop(property, value)
    });
//  导出表
    $("#dw").click(function () {
        var len = $("tbody input:checked").length;
        var data =$("tbody input:checked")

        if(len != 0) { //选择了要导出的订单
            //声明变量接受导出订单id
            var id_str = '';
            var f=''
            data.each(function(k,v) {
                id_str +=f+ $(v).val();
                f=',';
            })
            window.location.href="{:Url('Collect/daochu')}?id_str="+id_str;
        }else {
            alert('请选择要导出的订单');
        }
    })
})

</script>
<script>
//点击删除
/* $('.js-ajax-page-delete').click(function () { */
	/* function del(id){
	

 swal({
    	
        title: "您确定要删除这条信息吗",
        text: "删除后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "删除",
        closeOnConfirm: false
    }, function () {
    	 $.ajax({
            type: "post",//数据发送的方式（post 或者 get）
            url: "{:url('collect/delete')}",//要发送的后台地址
            data: {id:id},//要发送的数据（参数）格式为{'val1':"1","val2":"2"}
            dataType: "json",//后台处理后返回的数据格式
            success: function (data) {//ajax请求成功后触发的方法
            	  swal("删除成功！", "您已经删除了这条信息。", "success"); 
            },
            error: function (msg) {//ajax请求失败后触发的方法
            	  swal("删除失败！", ''", "error"); 
            }
        });
}); 
		$.post("{:Url('Collect/aas')}", {id: "id"},
		        function (data) {
			 if(data==0){
				 swal("删除成功！", "您已经删除了这条信息。", "success"); 
			 }			   
		          //  alert("1");
		  });
    		    
    		    
    		    
    		    
    		    
    		   
         
    }); 
	
    
    } */
    
/* }); */
</script>
